package com.szzg10.thinking.chapter11;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class LinkedListFeatures {

	public static void main(String[] args) {
		List<Pet> listPet = Arrays.asList(new Rat(), new Manx(), new Cymric(), new Mutt(), new Pug());
		LinkedList<Pet> pets = new LinkedList<Pet>(listPet);
		System.out.println(pets);
		
		System.out.println("pets.getFirst(): " + pets.getFirst());
		System.out.println("pets.element(): " + pets.element());
		System.out.println("pets.peek(): " + pets.peek());
		
		System.out.println("pets.remove(): " + pets.remove());
		System.out.println("pets.removeFirst(): " + pets.removeFirst());
		System.out.println("pets.poll(): " + pets.poll());
		
		System.out.println(pets);
		
		pets.addFirst(new Rat());
		System.out.println("After addFirst(): " + pets);
		
		pets.offer(new Cymric());
		System.out.println("After offer(): " + pets);
		
		pets.add(new Pug());
		System.out.println("After add(): " + pets);
		
		pets.addLast(new Hamster());
		System.out.println("After addLast(): " + pets);
		
		System.out.println("pets.removeLast(): " + pets.removeLast());
	}
}
